package com.cxria.script

class FuncUtils {

    def static tryFunc(int num, func){
        def result
        while (num > 0){
            num --
            result = func
            if(result != null){
                println '.'
                return result
            }
        }
        result
    }

    def static tryFunc(int num, exceFunc, parameters, resFunc){
        def result
        while (num > 0){
            num --
            result = exceFunc(parameters)
            if(resFunc(result)){
                return result
            }
        }
        result
    }

}
